#ifndef CHARACTER_H_GGJ
#define CHARACTER_H_GGJ

#include "../Objects/Object.h"
#include "../States/StateMachine.h"
#include <sfml\Graphics.hpp>

typedef sf::Vector2f v2f;

enum EAnimSprite
{
	EAnimSprite_LeftRight,
	EAnimSprite_UpDown,
};

class CCharacter : public CObject
{
public:
	CCharacter(CharacterType::Enum type);
	virtual ~CCharacter();

	void MoveLeft(float dt);
	void MoveRight(float dt);
	void MoveUp(float dt);
	void MoveDown(float dt);
	void UseSkill();
	void Update(float dt);

	virtual void Idle() = 0;

	void SetIsManaCharging(bool isCharging);
	void SetIsControllable(bool isControllable);

	int GetMana() const;
	int GetSkillCost() const;
	bool GetIsControllable() const;
	float GetMovementSpeed() const;
	float GetMaxCameraHeight() const;
	const std::string& GetSkillName() const;
	const std::string& GetSkillDesc() const;

	CharacterType::Enum GetCharacterType();
protected:
	void LoadDataFile();

	CStateMachine<CCharacter>* m_pStateMachine;
private:
	virtual void DoMoveUp(float dt) = 0;
	virtual void DoMoveDown(float dt) = 0;
	virtual void DoMoveLeft(float dt) = 0;
	virtual void DoMoveRight(float dt) = 0;
	virtual void DoUseSkill() = 0;
	virtual void DoUpdate(float dt) = 0;

	virtual bool DoCollidesWithCharacter(CCharacter* character) const { return true; } // all characters collide with each other

	CharacterType::Enum m_eCharacterType;

	int m_iMana;
	int m_iMaxMana;
	int m_iSkillCost;

	float m_fManaTimer;
	float m_fSecondsPerManaRate;
	float m_fMaxCameraHeight;
	float m_fMovementSpeed;
	
	std::string m_tSkillName;
	std::string m_tSkillDesc;

	bool m_bIsManaCharging;
	bool m_bIsControllable;
};

#endif // CHARACTER_H_GGJ